﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="ManageNotificationContents.aspx.cs"
    Inherits="Microsoft.InformationSecurity.RiskManagement.ISRMWeb.Tasks.ManageNotificationContents"
    MasterPageFile="~/CISFPortal_RightMenu.Master" %>

<%@ Register Assembly="CISFAjaxExtenders" Namespace="Microsoft.InformationSecurity.CISF.Web.AjaxExtenders"
    TagPrefix="cc2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="../UserControls/HtmlEditor.ascx" TagName="HtmlEditor" TagPrefix="uc1" %>
<asp:Content ID="DefaultPageContent" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <br />
    <div class="progressPopup">
        <asp:UpdateProgress ID="uprProgress" runat="server" DisplayAfter="200">
            <ProgressTemplate>
                <table class="progressBar" width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="center" style="width: 30%">
                            <asp:Image ID="imgUpdateProgress" ImageUrl="~/Images/LineSpinner-blue.gif" runat="server" />&nbsp;
                        </td>
                        <td>
                            <asp:Label ID="lblWaitMessage" Text="Please wait while processing data..." CssClass="messageWait"
                                Font-Bold="true" runat="server"></asp:Label>
                        </td>
                    </tr>
                </table>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>
    <script language="javascript">
    function hideModalPopup() {
        var dialog = $find('addContentPopup');
        if (dialog != null)
            dialog.hide();
            
        clearControls();

    }
    
    function showModalPopup() {
        var dialog = $find('addContentPopup');
        if (dialog != null)
            dialog.show();
    }
    
    function clearControls() 
    {
        theForm.<%=this.txtName.ClientID%>.value='';
        
    }
    </script>

    <table cellpadding="0" cellspacing="0" border="0" width="1020px">
        <tr>
            <td>
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td align="left" valign="middle" width="40">
                            <img src="../Images/EmailInbound-32.png" alt="Manage Notification Contents" />
                        </td>
                        <td valign="middle">
                            <asp:Label runat="server" ID="lblPageHeader" Text="" CssClass="labelPageheader"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <hr />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Button ID="btnAddNew" runat="server" Text="Add New" OnClick="btnAddNew_OnClick"
                    Width="75" UseSubmitBehavior="false" />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="upnlGridView" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                            OnSorting="GridView1_OnSorting" OnRowDataBound="GridView1_OnRowDataBound" OnRowDeleting="GridView1_OnRowDeleting"
                            OnRowEditing="GridView1_OnRowEditing" CssClass="table" EmptyDataText="No notification contents exist in the system.">
                            <AlternatingRowStyle CssClass="alternate" />
                            <EmptyDataRowStyle CssClass="emptyDataRowStyle" />
                            <Columns>
                                <asp:CommandField ShowEditButton="True" ItemStyle-Width="25" />
                                <asp:CommandField ShowDeleteButton="True" ItemStyle-Width="40" />
                                <asp:TemplateField HeaderText="Name" SortExpression="Name">
                                    <ItemTemplate>
                                        <asp:Label ID="NameLabel" runat="server" Text='<%#Microsoft.Security.Application.AntiXss.HtmlEncode(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.NotificationsService.NotificationContent)Container.DataItem).Name) %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="BodyType" SortExpression="IsHtml">
                                    <ItemTemplate>
                                        <%# Microsoft.InformationSecurity.RiskManagement.ISRMWeb.Tasks.ManageNotificationContents.GetBodyType(((Microsoft.InformationSecurity.RiskManagement.ISRMWeb.NotificationsService.NotificationContent)Container.DataItem).IsHtml)%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="NotificationsCount" HeaderText="Notifications Count" ReadOnly="True"
                                    SortExpression="NotificationsCount" />
                                <asp:BoundField DataField="LastUpdatedBy" HeaderText="Last Updated By" ReadOnly="True"
                                    SortExpression="LastUpdatedBy" />
                                <asp:TemplateField HeaderText="Last Updated" SortExpression="LastUpdatedDate" ItemStyle-Width="200">
                                    <ItemTemplate>
                                        <asp:Label ID="LastUpdatedLabel" runat="server" Text='<%#Eval("LastUpdatedDate") %>' />
                                        <cc2:UTCToLocalExtenderControl ID="UTCToLocalExtenderControl1" runat="server" TargetControlID="LastUpdatedLabel"
                                            DateTimeFormatString="d" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" Visible="False" />
                            </Columns>
                        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                <br />
            </td>
        </tr>
    </table>
    <div runat="server" id="invisbleDiv" style="visibility: hidden; display: none;">
    </div>
    <asp:Panel ID="pnlAddNotificationContent" runat="server" Width="550" Height="420"
        CssClass="modalWindow" Style="display: none;">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <table border="0" cellpadding="1" cellspacing="2" width="100%" align="center">
                    <tr>
                        <td colspan="2">
                            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                <tr>
                                    <td align="left" valign="middle" width="40">
                                        <img src="../Images/EmailAdd-32.png" alt="Add Notification Contents" />
                                    </td>
                                    <td valign="middle">
                                        <asp:Label runat="server" ID="lblHeader" Text="Add Notification Content" CssClass="labelPageheader"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <hr />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label runat="server" ID="lblErrorMessage" Text="*" ForeColor="Red"> </asp:Label>
                            <asp:Label ID="lblNameLabel" runat="server" Text="Name:" CssClass="headerlabel"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtName" runat="server" MaxLength="100" Width="300px"></asp:TextBox>
                            <cc1:FilteredTextBoxExtender ID="fteName" runat="server" FilterMode="ValidChars"
                                TargetControlID="txtName" ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-:()_ ">
                            </cc1:FilteredTextBoxExtender>
                            <cc1:TextBoxWatermarkExtender ID="waterMarkName" runat="server" TargetControlID="txtName"
                                WatermarkText="Enter name here..." WatermarkCssClass="watermark" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <asp:Label runat="server" ID="Label1" Text="*" ForeColor="Red"></asp:Label>
                            <asp:Label ID="lblBodyLabel" runat="server" Text="Body:" CssClass="headerlabel"></asp:Label>
                        </td>
                        <td>
                            <uc1:HtmlEditor ID="htmlEditor" runat="server" Width="400" Height="200" EditorBackColor="White"
                                ModalDialogBackColor="#f2f2f2" ImagesVirtualPath="../Images/NotificationContent"
                                ToolbarBackColor="White" ToolbarSelectionColor="#AECE75"></uc1:HtmlEditor>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnAddNew" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowEditing" />
            </Triggers>
        </asp:UpdatePanel>
        <div align="right">
            <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" Width="75" />
            &nbsp;<asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="75" />&nbsp;&nbsp;
        </div>
    </asp:Panel>
    <cc1:ModalPopupExtender ID="mpeContents" runat="server" BehaviorID="addContentPopup"
        TargetControlID="invisbleDiv" PopupControlID="pnlAddNotificationContent" CancelControlID="btnCancel"
        OnCancelScript="clearControls" BackgroundCssClass="modalBackground">
    </cc1:ModalPopupExtender>
</asp:Content>
